//
// Created by martin on 7/11/21.
//

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>

#include "config.h"

static FtpServer_Cfg_t config;

int config_init()
{
    int fd;

    if ((fd = open(CFG_FILE_PATH, O_RDONLY)) < 0) {
        fprintf(stderr, "config_init open error on file %s: %s\n", CFG_FILE_PATH, strerror(errno));
        exit(1);
    }

    close(fd);
}

int getRootPrivileged()
{
    if (setuid(0) < 0) { /* root user */
        return -1;
    }

    if (setgid(0) < 0) { /* root group */
        return -1;
    }

    return 0;
}